<template>
	<view class="pressure-day">
		<view class="pressure-echart">
			<view>
				<text><text class="tap">35</text>{{level}}压力</text>
				<text class="small">17:35</text>
			</view>
			<view class="echart">
				<pressureLineVue></pressureLineVue>
			</view>
		</view>
		<view class="pressure-expression">
			<view class="expression-title">
				<image src="/static/index/expression.png"></image>
				<text> 压力表情</text>
			</view>
			<view class="pressure-group">
			<view>
					<image :class="ifRelax === false? 'small-icon' : 'big-icon'" src="/static/index/relax.png"></image>
					<text>放松</text>
			</view>
			<view>
				<image :class="ifSlight === false? 'small-icon' : 'big-icon'" src="/static/index/slight.png"></image>
				<text>轻度</text>
			</view>
			<view>
				<image :class="ifMeduim === false? 'small-icon' : 'big-icon'" src="/static/index/medium.png"></image>
				<text>中度</text>
			</view>
			<view>
				<image :class="ifSerious === false? 'small-icon' : 'big-icon'" src="/static/index/serious.png"></image>
				<text>重度</text>
			</view>
		</view>
	</view>
	<view class="pressure-overview">
		<view>
			<image src="/static/index/overview.png"></image>
			<text>今日概览</text>
		</view>
		<view class="pressure-content">
			<view>
				<text class="tap">35</text>
				<text>最大压力</text>
			</view>
			<view>
				<text class="tap">35</text>
				<text>最小压力</text>
			</view>
			<view>
				<text class="tap">35</text>
				<text>平均压力</text>
			</view>
		</view>
	</view>
	</view>
</template>

<script setup>
	import {
		onMounted,
		ref
	} from 'vue';
	import pressureLineVue from '../../../ucharts/pressure/pressureLine.vue';
	//压力程度
	let level = ref("轻度");
	//轻度
	let ifRelax = ref(false);
	let ifSlight = ref(false);
	let ifMeduim = ref(false);
	let ifSerious = ref(false);
	onMounted(() => {
		// let expressions=document.querySelectorAll(".small-icon");
		// expressions.border="1px solid black";
		//根据压力程度选择图片样式
		switch (level.value) {
			case "放松":
				ifRelax.value = true;
				break;
			case "轻度":
				ifSlight.value = true;
				break;
			case "中度":
				ifMeduim.value = true;
				break;
			case "重度":
				ifSerious.value = true;
				break;
		}
	})
</script>

<style scoped>
	.pressure-day {
		paddingr: 0rpx 10rpx 0rpx 10rpx;
		margin-top: 240rpx;
		height: auto;
		display: flex;
		flex-direction: column;
		flex-wrap: nowrap;
		justify-content: flex-start;

	}

	text {
		margin: 8rpx 0rpx 0rpx 20rpx;
	}

	.pressure-echart {
		height: 620rpx;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		margin: 10rpx 20rpx;
		padding-top: 20rpx;
		box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
		border-radius: 25rpx;
	}

	.pressure-echart view:nth-child(1) {
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
	}

	.small {
		font-size: 24rpx;
		color: #868686;
		margin-left: 20rpx;
	}

	image {
		margin-left: 20rpx;
		width: 50rpx;
		height: 50rpx;
	}

	/* echart图 */
	.echart {
		width: 100%;
		height: 80%;
	}

	.tap {
		font-size: 44rpx;
	}

	.small-icon {
		width: 50rpx;
		height: 50rpx;
	}

	/* 将压力程度图片变大样式 */
	.big-icon {
		position: absolute;
		bottom:40%;
		width: 90rpx;
		height:90rpx;
	}
    .big-icon~text{
		margin-top:80%;
		color: red;
	}
	.pressure-content {
		width: 100%;
		height: 80%;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: flex-start;
	}

	.pressure-content>view {
		width: 45%;
		height: 30%;
		display: flex;
		flex-direction: column;
		flex-wrap: wrap;
		justify-content: flex-start;
		align-items: center;
		margin-top: 20rpx;
		margin-left: 20rpx;

	}

	.pressure-content view:nth-child(1),
	.pressure-content view:nth-child(3) {
		border-right: 4rpx dotted #d1d1d1;
	}

	.pressure-overview>view:nth-child(1) {
		width: 100%;
		height: 20%;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: flex-start;
		border-bottom: 4rpx solid #d1d1d1;
		align-items: center;
	}

	.pressure-overview {
		height: 620rpx;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		margin: 10rpx 20rpx;
		padding-top: 20rpx;
		box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
		border-radius: 25rpx;
	}

	.pressure-expression {
		height:50%;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		margin: 10rpx 20rpx;
		padding:20rpx 0rpx ;
		box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
		border-radius: 25rpx;
	}

	.pressure-group {
		position: relative;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: space-evenly;
	}

	.pressure-group>view {
		font-size: 24rpx;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
	}

	.expression-title {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		margin-bottom: 60rpx;
	}
</style>